<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
session_start();

$listView8 	= 8;
$listView24	= 24;
$currentURL = $_SERVER["REQUEST_URI"];
if(isset($_GET['perPageRecord']) && $_GET['perPageRecord'] != ""){
	$currentURL = str_replace("?perPageRecord=".$_GET['perPageRecord'], "", $currentURL);
	$currentURL = str_replace("&perPageRecord=".$_GET['perPageRecord'], "", $currentURL);
}

$pos = strpos($currentURL, "?");

if($pos == true){
	$phpFile	= $currentURL."&perPageRecord=";
}else{
	$phpFile	= $currentURL."?perPageRecord=";
}


if($_SESSION['perPageRecord'] == ""){
	$_SESSION['perPageRecord'] = 8;
	$listViewHtml = "<span><a href=\"".$phpFile.$listView24."\">View ".$listView24." Items Per Page</a></span> |";
}else{
	if(isset($_GET['perPageRecord']) && $_GET['perPageRecord'] != "") $_SESSION['perPageRecord'] = $_GET['perPageRecord'];
	$listViewHtml = "<span><a href=\"".$phpFile.$_SESSION['perPageRecord']."\">View ".$_SESSION['perPageRecord']." Items Per Page</a></span> |";
}

if($_SESSION['perPageRecord'] == 24){
	$listViewHtml = "<span><a href=\"".$phpFile.$listView8."\">View ".$listView8." Items Per Page</a></span> |";
}else{
	$listViewHtml = "<span><a href=\"".$phpFile.$listView24."\">View ".$listView24." Items Per Page</a></span> |";
}

echo $listViewHtml;

?>